import java.util.Scanner;

public class Zwq {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while(true){
            int randomNum = (int)(Math.random()*100+1);
            while(true) {
                System.out.println("请输入一个1~100之间的整数");
                int userNum= input.nextInt();
                if(userNum>randomNum) {
                    System.out.println("你输入的数大了");
                    continue;
                }
                if(userNum<randomNum) {
                    System.out.println("你输入的数小了");
                    continue;
                }
                if(userNum==randomNum) {
                    System.out.println("你猜对了");
                    break;
                }
            }
            System.out.println("请问您要在玩一次吗（y/n）");
            String userCheck = input.next();
            if(userCheck.equals("y")) {
                continue;
            }else if(userCheck.equals("n")){
                System.out.println("游戏结束！");
                break;
            }else {
                System.out.println("输入错误！游戏结束！");
                break;
            }
        }
    }
}
